(deftemplate color
	(slot numero)
	(slot pos1)
	(slot pos2)
	(slot pos3)
	(slot pos4)
	(slot numPosibles)
	)

(deftemplate jugada
	(slot clavija0)
	(slot clavija1)
	(slot clavija2)
	(slot clavija3))

(deftemplate respuesta
	(slot aciertos)
	(slot aprox))

(deftemplate intentos
	(slot intent))
	
(deftemplate regla1
	(slot booleano))
(deftemplate numColores
	(slot n))
	
(deftemplate clavijas
	(slot clav0)
	(slot clav1)
	(slot clav2)
	(slot clav3)
)
	
(defrule todos 
	(declare (salience 70))	
	?col <- (color (numero ?c)(pos1 ?p)(pos2 ?p)(pos3 ?p)(pos4 ?p)(numPosibles ?n))
	?r1 <- (regla1 (booleano ?b));;se aplica la primera regla.
	?nc <- (numColores(n ?ncol))
	(test (and(= ?p 50)(< ?b ?ncol)))
=> 
    (bind ?h (+ ?b 1))
  	(modify ?r1(booleano ?h))
  	(store "clavija0" ?c)
  	(store "clavija1" ?c)
 	(store "clavija2" ?c)
    (store "clavija3" ?c)
	)
(defrule solucion000
	(declare (salience 1))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p1 0)(> ?n 0))(= ?cl0 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav0 0))
    (store "clavija0" ?c1)	
)
(defrule solucion005
	(declare (salience 2))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p1 5)(> ?n 0))(= ?cl0 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav0 0))
    (store "clavija0" ?c1)	
)
(defrule solucion010
	(declare (salience 3))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p1 10)(> ?n 0))(= ?cl0 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav0 0))
    (store "clavija0" ?c1)	
)
(defrule solucion015
	(declare (salience 4))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p1 15)(> ?n 0))(= ?cl0 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav0 0))
    (store "clavija0" ?c1)	
)
(defrule solucion020
	(declare (salience 5))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p1 20)(> ?n 0))(= ?cl0 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav0 0))
    (store "clavija0" ?c1)	
)
(defrule solucion025
	(declare (salience 6))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p1 25)(> ?n 0))(= ?cl0 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav0 0))
    (store "clavija0" ?c1)	
)
(defrule solucion030
	(declare (salience 7))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p1 30)(> ?n 0))(= ?cl0 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav0 0))
    (store "clavija0" ?c1)	
)
(defrule solucion035
	(declare (salience 8))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p1 35)(> ?n 0))(= ?cl0 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav0 0))
    (store "clavija0" ?c1)	
)
(defrule solucion040
	(declare (salience 9))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p1 40)(> ?n 0))(= ?cl0 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav0 0))
    (store "clavija0" ?c1)	
)
(defrule solucion045
	(declare (salience 10))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p1 45)(> ?n 0))(= ?cl0 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav0 0))
    (store "clavija0" ?c1)	
)
(defrule solucion050
	(declare (salience 11))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p1 50)(> ?n 0))(= ?cl0 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav0 0))
    (store "clavija0" ?c1)	
)
(defrule solucion055
	(declare (salience 12))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p1 55)(> ?n 0))(= ?cl0 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav0 0))
    (store "clavija0" ?c1)	
)
(defrule solucion060
	(declare (salience 13))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p1 60)(> ?n 0))(= ?cl0 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav0 0))
    (store "clavija0" ?c1)	
)
(defrule solucion065
	(declare (salience 14))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p1 65)(> ?n 0))(= ?cl0 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav0 0))
    (store "clavija0" ?c1)	
)
(defrule solucion070
	(declare (salience 15))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p1 70)(> ?n 0))(= ?cl0 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav0 0))
    (store "clavija0" ?c1)	
)
(defrule solucion075
	(declare (salience 16))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p1 75)(> ?n 0))(= ?cl0 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav0 0))
    (store "clavija0" ?c1)	
)
(defrule solucion080
	(declare (salience 17))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p1 80)(> ?n 0))(= ?cl0 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav0 0))
    (store "clavija0" ?c1)	
)
(defrule solucion085
	(declare (salience 18))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p1 85)(> ?n 0))(= ?cl0 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav0 0))
    (store "clavija0" ?c1)	
)
(defrule solucion090
	(declare (salience 19))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p1 90)(> ?n 0))(= ?cl0 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav0 0))
    (store "clavija0" ?c1)	
)
(defrule solucion095
	(declare (salience 20))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p1 95)(> ?n 0))(= ?cl0 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav0 0))
    (store "clavija0" ?c1)	
)
(defrule solucion0100
	(declare (salience 21))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(>= ?p1 100)(> ?n 0))(= ?cl1 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav0 0))
    (store "clavija0" ?c1)	
)
(defrule solucion100
	(declare (salience 1))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p2 0)(> ?n 0))(= ?cl1 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav1 0))
    (store "clavija1" ?c1)	
)
(defrule solucion105
	(declare (salience 2))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p2 5)(> ?n 0))(= ?cl1 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav1 0))
    (store "clavija1" ?c1)	
)
(defrule solucion110
	(declare (salience 3))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p2 10)(> ?n 0))(= ?cl1 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav1 0))
    (store "clavija1" ?c1)	
)
(defrule solucion115
	(declare (salience 4))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p2 15)(> ?n 0))(= ?cl1 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav1 0))
    (store "clavija1" ?c1)	
)
(defrule solucion120
	(declare (salience 5))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p2 20)(> ?n 0))(= ?cl1 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav1 0))
    (store "clavija1" ?c1)	
)
(defrule solucion125
	(declare (salience 6))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p2 25)(> ?n 0))(= ?cl1 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav1 0))
    (store "clavija1" ?c1)	
)
(defrule solucion130
	(declare (salience 7))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p2 0)(> ?n 0))(= ?cl1 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav1 0))
    (store "clavija1" ?c1)	
)
(defrule solucion135
	(declare (salience 8))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p2 35)(> ?n 0))(= ?cl1 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav1 0))
    (store "clavija1" ?c1)	
)
(defrule solucion140
	(declare (salience 9))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p2 40)(> ?n 0))(= ?cl1 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav1 0))
    (store "clavija1" ?c1)	
)
(defrule solucion145
	(declare (salience 10))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p2 45)(> ?n 0))(= ?cl1 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav1 0))
    (store "clavija1" ?c1)	
)
(defrule solucion150
	(declare (salience 11))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p2 50)(> ?n 0))(= ?cl1 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav1 0))
    (store "clavija1" ?c1)	
)
(defrule solucion155
	(declare (salience 12))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p2 55)(> ?n 0))(= ?cl1 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav1 0))
    (store "clavija1" ?c1)	
)
(defrule solucion160
	(declare (salience 13))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p2 60)(> ?n 0))(= ?cl1 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav1 0))
    (store "clavija1" ?c1)	
)
(defrule solucion165
	(declare (salience 14))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p2 65)(> ?n 0))(= ?cl1 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav1 0))
    (store "clavija1" ?c1)	
)
(defrule solucion170
	(declare (salience 25))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p2 70)(> ?n 0))(= ?cl1 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav1 0))
    (store "clavija1" ?c1)	
)
(defrule solucion175
	(declare (salience 16))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p2 75)(> ?n 0))(= ?cl1 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav1 0))
    (store "clavija1" ?c1)	
)
(defrule solucion180
	(declare (salience 17))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p2 80)(> ?n 0))(= ?cl1 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav1 0))
    (store "clavija1" ?c1)	
)
(defrule solucion185
	(declare (salience 18))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p2 85)(> ?n 0))(= ?cl1 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav1 0))
    (store "clavija1" ?c1)	
)
(defrule solucion190
	(declare (salience 19))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p2 90)(> ?n 0))(= ?cl1 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav1 0))
    (store "clavija1" ?c1)	
)
(defrule solucion195
	(declare (salience 20))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p2 95)(> ?n 0))(= ?cl1 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav1 0))
    (store "clavija1" ?c1)	
)
(defrule solucion1100
	(declare (salience 21))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(>= ?p2 100)(> ?n 0))(= ?cl1 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav1 0))
    (store "clavija1" ?c1)	
)
(defrule solucion20
	(declare (salience 1))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p3 0)(> ?n 0))(= ?cl2 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav2 0))
    (store "clavija2" ?c1)	
)
(defrule solucion205
	(declare (salience 2))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p3 5)(> ?n 0))(= ?cl2 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav2 0))
    (store "clavija2" ?c1)	
)
(defrule solucion21
	(declare (salience 3))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p3 10)(> ?n 0))(= ?cl2 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav2 0))
    (store "clavija2" ?c1)	
)
(defrule solucion215
	(declare (salience 4))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p3 15)(> ?n 0))(= ?cl2 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav2 0))
    (store "clavija2" ?c1)	
)
(defrule solucion22
	(declare (salience 5))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p3 20)(> ?n 0))(= ?cl2 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav2 0))
    (store "clavija2" ?c1)	
)
(defrule solucion225
	(declare (salience 6))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p3 25)(> ?n 0))(= ?cl2 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav2 0))
    (store "clavija2" ?c1)	
)
(defrule solucion23
	(declare (salience 7))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p3 30)(> ?n 0))(= ?cl2 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav2 0))
    (store "clavija2" ?c1)	
)
(defrule solucion235
	(declare (salience 8))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p3 35)(> ?n 0))(= ?cl2 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav2 0))
    (store "clavija2" ?c1)	
)
(defrule solucion24
	(declare (salience 9))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p3 40)(> ?n 0))(= ?cl2 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav2 0))
    (store "clavija2" ?c1)	
)
(defrule solucion245
	(declare (salience 10))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p3 45)(> ?n 0))(= ?cl2 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav2 0))
    (store "clavija2" ?c1)	
)
(defrule solucion25
	(declare (salience 11))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p3 50)(> ?n 0))(= ?cl2 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav2 0))
    (store "clavija2" ?c1)	
)
(defrule solucion245
	(declare (salience 12))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p3 55)(> ?n 0))(= ?cl2 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav2 0))
    (store "clavija2" ?c1)	
)

(defrule solucion26
	(declare (salience 13))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p3 60)(> ?n 0))(= ?cl2 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav2 0))
    (store "clavija2" ?c1)	
)
(defrule solucion265
	(declare (salience 14))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p3 65)(> ?n 0))(= ?cl2 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav2 0))
    (store "clavija2" ?c1)	
)
(defrule solucion27
	(declare (salience 15))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p3 70)(> ?n 0))(= ?cl2 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav2 0))
    (store "clavija2" ?c1)	
)
(defrule solucion275
	(declare (salience 16))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p3 75)(> ?n 0))(= ?cl2 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav2 0))
    (store "clavija2" ?c1)	
)
(defrule solucion28
	(declare (salience 17))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p3 80)(> ?n 0))(= ?cl2 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav2 0))
    (store "clavija2" ?c1)	
)
(defrule solucion285
	(declare (salience 18))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p3 85)(> ?n 0))(= ?cl2 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav2 0))
    (store "clavija2" ?c1)	
)
(defrule solucion29
	(declare (salience 19))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p3 90)(> ?n 0))(= ?cl2 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav2 0))
    (store "clavija2" ?c1)	
)
(defrule solucion295
	(declare (salience 20))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p3 95)(> ?n 0))(= ?cl2 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav2 0))
    (store "clavija2" ?c1)	
)
(defrule solucion2100
	(declare (salience 21))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(>= ?p3 100)(> ?n 0))(= ?cl2 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav2 0))
    (store "clavija2" ?c1)	
)
(defrule solucion30
	(declare (salience 1))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p4 0)(> ?n 0))(= ?cl3 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav3 0))
    (store "clavija3" ?c1)	
)
(defrule solucion305
	(declare (salience 2))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p4 5)(> ?n 0))(= ?cl3 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav3 0))
    (store "clavija3" ?c1)	
)
(defrule solucion31
	(declare (salience 3))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p4 10)(> ?n 0))(= ?cl3 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav3 0))
    (store "clavija3" ?c1)	
)
(defrule solucion315
	(declare (salience 4))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p4 15)(> ?n 0))(= ?cl3 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav3 0))
    (store "clavija3" ?c1)	
)
(defrule solucion32
	(declare (salience 5))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p4 20)(> ?n 0))(= ?cl3 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav3 0))
    (store "clavija3" ?c1)	
)
(defrule solucion325
	(declare (salience 6))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p4 25)(> ?n 0))(= ?cl3 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav3 0))
    (store "clavija3" ?c1)	
)
(defrule solucion33
	(declare (salience 7))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p4 30)(> ?n 0))(= ?cl3 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav3 0))
    (store "clavija3" ?c1)	
)
(defrule solucion335
	(declare (salience 8))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p4 35)(> ?n 0))(= ?cl3 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav3 0))
    (store "clavija3" ?c1)	
)
(defrule solucion34
	(declare (salience 9))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p4 40)(> ?n 0))(= ?cl3 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav3 0))
    (store "clavija3" ?c1)	
)
(defrule solucion345
	(declare (salience 10))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p4 45)(> ?n 0))(= ?cl3 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav3 0))
    (store "clavija3" ?c1)	
)
(defrule solucion35
	(declare (salience 11))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(> ?p4 50)(> ?n 0)))
	(test (and(and(> ?p4 50)(> ?n 0))(= ?cl3 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav3 0))
    (store "clavija3" ?c1)	
)
(defrule solucion355
	(declare (salience 12))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p4 55)(> ?n 0))(= ?cl3 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav3 0))
    (store "clavija3" ?c1)	
)
(defrule solucion36
	(declare (salience 13))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p4 60)(> ?n 0))(= ?cl3 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav3 0))
    (store "clavija3" ?c1)	
)
(defrule solucion365
	(declare (salience 14))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p4 65)(> ?n 0))(= ?cl3 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav3 0))
    (store "clavija3" ?c1)	
)
(defrule solucion37
	(declare (salience 15))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p4 70)(> ?n 0))(= ?cl3 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav3 0))
    (store "clavija3" ?c1)	
)
(defrule solucion375
	(declare (salience 16))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p4 75)(> ?n 0))(= ?cl3 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav3 0))
    (store "clavija3" ?c1)	
)
(defrule solucion38
	(declare (salience 17))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p4 80)(> ?n 0))(= ?cl3 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav3 0))
    (store "clavija3" ?c1)	
)
(defrule solucion385
	(declare (salience 18))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p4 85)(> ?n 0))(= ?cl3 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav3 0))
    (store "clavija3" ?c1)	
)
(defrule solucion39
	(declare (salience 19))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p4 90)(> ?n 0))(= ?cl3 1)))
	
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav3 0))
    (store "clavija3" ?c1)	
)
(defrule solucion395
	(declare (salience 20))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p4 95)(> ?n 0))(= ?cl3 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav3 0))
    (store "clavija3" ?c1)	
)
(defrule solucion3100
	(declare (salience 21))
    ?col1 <- (color (numero ?c1)(pos1 ?p1)(pos2 ?p2)(pos3 ?p3)(pos4 ?p4)(numPosibles ?n))
    ?clav <- (clavijas (clav0 ?cl0) (clav1 ?cl1) (clav2 ?cl2) (clav3 ?cl3))
	(test (and(and(> ?p4 95)(> ?n 0))(= ?cl3 1)))
    =>
    (bind ?h (- ?n 1))
  	(modify ?col1(numPosibles ?h))
  	(modify ?clav (clav3 0))
    (store "clavija3" ?c1)	
)

